Skip to content

CP-540722: Define the MIRROR interface to be implemented by Storage_smapi{v1,v3}_migrate.ml #6404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 11, 2025

Conversation

Vincent-lau
Copy link
Contributor

This is a continuation of #6378: the refactoring effort of SXM code.

To be continued...

@Vincent-lau Vincent-lau force-pushed the private/shul2/sxm-mux2 branch 2 times, most recently from 3ed0aba to 743f149 Compare April 3, 2025 16:40
@Vincent-lau Vincent-lau force-pushed the private/shul2/sxm-mux2 branch from 743f149 to 3267ec3 Compare April 4, 2025 09:51
`import_activate` and `get_nbd_server` is more like datapath functions
so I am moving them into the `DATA` module whereas they were previoulsy
in `DATA.MIRROR` module.

Reserve `DATA.MIRROR` only for storage migrate functionalities that is
implemented in the xapi layer but no in the storage layer.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
There are several functions in storage_interface and hence storage_mux,
such as `start`, `stop`, `list`.

These functions are currently not multiplexed but just called
directly into storage_migrate. In fact, they are unlikely to be
multiplexed because they use the `State` module in storage migrate,
which is a in memory hashtable in xapi, not accessible by
xapi-storage-script.

So remove them from the storage interface, and callers of these
functions can call them from storage_migrate directly rather than
going through the storage interface.

None of these are remote functions so no need to worry about backwards
compatibility.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
The `send_start` function is a subroutine inside the
`Storage_migrate.start` function, which takes the mirror prepared by the
`receive_start` and initiates mirroring to the remote VDI.

This commit only defines the interface, which means this function is
currently unused.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
Just so that they type check, some of the functions are still
unimplemented, and these functions are still unused.

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
@lindig
Copy link
Contributor

lindig commented Apr 4, 2025

Would suggest to replace:

  • List.find with List.find_opt and avoid try .. with
  • failwith with let failwith_fmt fmt = Printf.ksprintf failwith fmt

@Vincent-lau Vincent-lau force-pushed the private/shul2/sxm-mux2 branch from 3267ec3 to 36d41aa Compare April 4, 2025 09:57
Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
@Vincent-lau Vincent-lau changed the title Define the MIRROR interface to be implemented by Storage_smapi{v1,v3}_migrate.ml CP-540722: Define the MIRROR interface to be implemented by Storage_smapi{v1,v3}_migrate.ml Apr 4, 2025
let nearest =
List.fold_left
(fun acc content_id ->
match acc with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a fold? I understand it returns the first acc it finds - so It is more like a find.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, problem of using List.find is that it will return an element in similar while what we want is an element in vdis

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talked it with Vincent, the List.finds can't be switched, because ordering is important

Signed-off-by: Vincent Liu <shuntian.liu2@cloud.com>
@Vincent-lau Vincent-lau added this pull request to the merge queue Apr 11, 2025
Merged via the queue into xapi-project:master with commit d1dd44e Apr 11, 2025
17 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Apr 17, 2025
This is a continuation of #6404, which completes the refactoring of SXM
code for the new architecture.

I expect there to be no functional change, although there is a
significant change of how error handling is done.

The last couple of commits contain the design for this PR.

To be continued...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants